package com.lihuan.dao;

import com.lihuan.beans.*;
import com.lihuan.entity.Message;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MessageDao {

    /** 查询留言列表 */
    //@Select("select * from me_message ")
    List<MessageListItem> listMessage(MessageList param);

    /** 添加留言 */
    void addMessage(Message bean);

    /** 根据id查询 留言 对象 */
    @Select("select * from me_message where `id` = #{id}")
    Message getMessageById(@Param("id") String id);

    /** 根据id查询 留言 对象 */
    @Select("select a.* ,b.nickname as name from me_message a left join sys_user b on a.user_id = b.id where a.`id` = #{id}")
    MessageInfo infoMessage(@Param("id") String id);

    /** 修改留言 */
    void editMessage(Message bean);

    /** 删除留言 */
    @Delete("Delete from me_message where `id` = #{id}")
    void removeMessage(MessageId param);

}
